#include <iostream>
using namespace std;

void solve() {
    long long w, h, a, b;
    long long x1, y1, x2, y2;
    
    cin >> w >> h >> a >> b;
    cin >> x1 >> y1 >> x2 >> y2;

    // Check if the two tiles are aligned in either direction
    bool col_aligned = (x1 != x2) && ((x2 - x1 + a) % a == 0);
    bool row_aligned = (y1 != y2) && ((y2 - y1 + b) % b == 0);

    if (col_aligned || row_aligned) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }
}

int main() {
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}